import 'package:flutter/material.dart';
import 'package:flutter_basic/basic/basic_controller.dart';
import 'package:get/get.dart';

import 'trans_home/controller.dart';
import 'trans_home/trans_home_page.dart';
import 'trans_list/controller.dart';
import 'trans_list/trans_list_page.dart';

class TransactionPageController extends BasicController{

  String? _tag;
  int currentPage = 0;
  List<Widget> _pages = <Widget>[];

  PageController pageController = PageController(
    initialPage: 0,
    viewportFraction: 1,
    keepPage: true,
  );

  List<Widget> pages(String? tag) {
    if(_tag != tag){
      _tag = tag;
      _pages.clear();
    }
    if(_pages.isEmpty){
      _pages = <Widget>[
        TransHomePage.bind(TransHomePageController(), tag: tag),
        TransListPage.bind(TransListPageController(), tag: tag)
      ];
    }
    return _pages;
  }

  @override
  void onInit() {
    super.onInit();
    // Map<String, dynamic> param = Get.currentRoute;
    print('TransactionPageController:${Get.arguments}');
  }

}